@extends('Admin.layout')
@section('header')
    <style>
        .el-cascader-menu__wrap.el-scrollbar__wrap{
            height: auto;
        }
    </style>
@endsection
@section('main')

    <el-cascader-panel
            style="height: calc(100vh - 50px);"
            v-model="permission"
            :options="options"
            :props="props">
    </el-cascader-panel>
    <div style="display: flex;justify-content: center">
        <el-button style="margin-top: 10px;" type="primary" @click="submit">确认设置</el-button>
    </div>
@endsection

@section('footer')
    <script>

       VueInit.data.options = {!! json_encode($route, JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT) !!};
       VueInit.data.props = {
           value: "id",
           label: "title",
           multiple:true,
       };

       VueInit.data.permission = {!! json_encode($default) !!};

       VueInit.methods.submit = function (){
           axios({
               url:"",
               method:"post",
               data: {
                   route_ids:this.permission
               }
           }).then(({ data }) => {
               if(data.code === 200){
                   parent.layer.closeAll();
                   parent.VueApp.$message.success("设置成功");
               }else{
                   this.$message.error(data.msg);
               }
           })
       }
    </script>
@endsection